<!--安全-->
<template>

  <div class="all bg1" @viewappear="viewappear">
    
    <div class="cell bt1" @click="gaSetClick">
      <text class="font30 text2 all">{{T('谷歌验证器')}}</text>

      <text class="font26 text3" v-if="gaBind">{{T('已绑定')}}</text>
      <text class="font26 warning-t1" v-else>{{T('未绑定')}}</text>
      <LImage class="img-arrow" :src="Config.img('jiantou_hui.png')"></LImage>      
    </div>
    <div class="line line1"></div>
    
    <div class="cell bt1" @click="pwdClick">
      <text class="font30 text2 all">{{T('修改登录密码')}}</text>

      <LImage class="img-arrow" :src="Config.img('jiantou_hui.png')"></LImage>      
    </div>
    <div class="line line1"></div>

    <div class="cell bt1" @click="sfrzClick">
      <text class="font30 text2 all">{{T('身份认证')}}</text>

      <LImage class="img-arrow" :src="Config.img('jiantou_hui.png')"></LImage>      
    </div>
    <div class="line line1"></div>
  </div>
</template>

<style src="@/_css/style.css" ></style>
<style scoped>

.cell {
  flex-direction: row;
  align-items: center;
  height:118px;

  padding-left: 40px;
  padding-right: 40px;
}
.line{
  height: 1px;
  margin-left: 40px;
}
.img-arrow {
  width: 16px;
  height: 26px;
  margin-left: 20px;
}
</style>

<script>

import jnavigator from "@/_js/navigator";
import jconfig from "@/_js/config";
import jhttps from "@/_js/https"; ;

const weexFunction = weex.requireModule("WeexFunction");

import I18N from "@/_i18n/i18n";
var T = I18N.t;
weexFunction.setTitle(T('安全'));

export default {
  
  data() {
    return {
      T:T,
      Config:jconfig,
      gaBind:false, //turn 已绑定
    };
  },

  created(){
    this.httpGaBindInfo();
  },

  methods: {
    /*************************************************通信触发*/
    //完全显示
    viewappear() {
      this.httpGaBindInfo();
    },
    
    /********************************** HTTP*/
    //https获取绑定信息
    httpGaBindInfo() {
      var param = {};
      jhttps.postX("systemV2/getUserGAIsBind", param, true, (data)=>{
        if(data.status == 200){
          this.gaBind = data.data;
        }else{
          jmodal.toast(data.msg);
        }
      });
    },

    /************************************************* 点击事件*/
    //设置Ga
    gaSetClick(){ 
      
      var nav = {'navColor':'#0c0c0c'};
      if(this.gaBind){
        jnavigator.open('', "mine/GaSet", undefined, nav);
      } else {
        jnavigator.open('', "mine/GABind", undefined, nav);
      }
    },
    
    //修改密码
    pwdClick(){
      jnavigator.openNative("updatePwd", "");
    },

    //身份认证
    sfrzClick() {
      jnavigator.open('', "klc/Klc");
    }
  }
};
</script>
